﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Vowei.Core.Models;

namespace Vowei.Data.Models
{
    public partial class Risk : Task, IRisk, IHasRelated<ITicket>
    {
        public Risk()
        {
        }

        IQueryable<ITask> IRisk.MitigationPlans
        {
            get
            {
                return MitigationPlans.AsQueryable<ITask>();
            }
        }

        IQueryable<ITask> IRisk.ContingencyPlans
        {
            get
            {
                return ContingencyPlans.AsQueryable<ITask>();
            }
        }

        IQueryable<ITicket> IHasRelated<ITicket>.RelatedTickets
        {
            get { return RelatedTickets.AsQueryable<ITicket>(); }
        }
        
        IQueryable<IProject> IRisk.AffectedProjects
        {
            get { return AffectedProjects.AsQueryable<IProject>(); }
        }

        public void AddRelated(ITicket ticket)
        {
            RelatedTickets.Add((Ticket)ticket);
        }

        public void RemoveRelated(ITicket ticket)
        {
            RelatedTickets.Remove((Ticket)ticket);
        }

        public void ClearRelated()
        {
            RelatedTickets.Clear();
        }
    }
}
